/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package RandomTest;

import java.util.*;

/**
 *
 * @author trang
 */
public class RandomTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        int [] ndigits = new int[10];
        double  x;
        int n;

        Random myRandom = new Random();
// Initialize the array
        for (int i = 0; i < ndigits.length; i++) {
            ndigits[i]=0;
        }
// Test the ramndom number generator a whole lot
        
        for (int i = 0; i < 100; i++) {
// Generate a new random number between 0 and 9
            
           x=myRandom.nextDouble()*10;
            n=(int)x;
//            count the digits in the ran dom number 
            ndigits[n]++;
            
        }



//        Print the result
        for (int i = 0; i < ndigits.length; i++) {
            System.out.println(i + ":" + ndigits[i]);
        }


    }

}
